<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>按起终点名称规划路线</title>
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <style type="text/css">
	    body
        {
            margin: 0;
            height: 100%;
            width: 100%;
            position: absolute;
            font-size: 12px;
        }
		#container{
		  position: absolute;
            top: 58px;
            margin: 15px;
            left: 8px;
            border: 1px solid #080808;
            right: 8px;
            bottom: 0;
		}
        #panel {
            position: fixed;
            background-color: white;
            max-height: 90%;
            overflow-y: auto;
            top: 60px;
            right: 10px;
            width: 280px;
        }
    </style>
	<script src="http://cache.amap.com/lbs/static/es5.min.js"></script>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=1994ba35a603f806df16000f3799b1da&plugin=AMap.Walking"></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
	<script type="text/javascript" src="http://cache.amap.com/lbs/static/WalkingRender1230.js"></script>
</head>
<body>
<br>
 <input type="text" id="start" placeholder="请输入开始位置"/>
 <input type="text" id="end" placeholder="请输入结束位置"/>
 <input type="button" value="提交" onclick="dj()"/>
<div id="container"></div>
<div id="panel"></div>
<script type="text/javascript">
    var map = new AMap.Map("container", {
        resizeEnable: true,
        center: [118.313861,32.275823],//地图中心点
        zoom: 13 //地图显示的缩放级别
    });
    function dj()
	{
	   var start=document.getElementById("start").value;
       var end=document.getElementById("end").value;
      // var a='滁州学院图书馆(会峰校区))';
      //  var b='滁州学院文学楼(会峰校区)';
    
		//步行导航
		var walking = new AMap.Walking({
			map: map,
			panel: "panel"
		}); 
		walking.search([
			{keyword:start},
			{keyword:end}
		]);
	
	}
   
	//实现路线可以拖动的功能
	/*
	 var path = [];
    path.push([118.316731,32.276821]);
    path.push([118.314601,32.277129]);
    path.push([118.311786,32.275541]);
	map.plugin("AMap.DragRoute", function() {
        route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE); //构造拖拽导航类
        route.search(); //查询导航路径并开启拖拽导航
    });*/
</script>
</body>
</html>